﻿using Enums;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Model.Models
{
    /// <summary>
    /// 公用文件表
    /// </summary>
    [SugarTable(tableName: "Bas_File")]
    public class Bas_File
    {
        /// <summary>
        /// 主键id
        /// </summary>
        [Key]
        [StringLength(50)]
        [Description("主键")]
        [SugarColumn(IsPrimaryKey = true, IsIdentity = true)]
        public int Id { get; set; }

        /// <summary>
        /// 业务类型
        /// </summary>
        [SugarColumn(ColumnName = "ServiceType", IsNullable = false)]
        public EmunFileServiceType ServiceType { get; set; }

        /// <summary>
        /// 业务类型 下级类型 自选字段 可用可不用
        ///<para> 工单类型：1：需求单，2：制作单，3：变更单，4：售后单，5：返修单，6：技术变更单</para>
        ///<para>软件版本id</para>
        /// </summary>
        [SugarColumn(ColumnName = "ServiceTypeNode")]
        public int? ServiceTypeNode { get; set; }

        /// <summary>
        /// 对应业务主键 ID string 类型
        /// </summary>
        [SugarColumn(ColumnName = "ServiceId")]
        public string ServiceId { get; set; }

        /// <summary>
        /// 第二id
        /// <para>工单：归属单号</para>
        /// </summary>
        public string ServiceSecondId { get; set; }

        /// <summary>
        /// 对应业务主键 ID int 类型
        /// <para>软件id</para>
        /// </summary>
        [SugarColumn(ColumnName = "ServiceIdInt")]
        public int? ServiceIdInt { get; set; }

        /// <summary>
        /// 业务状态 灵活使用
        /// </summary>
        [SugarColumn(ColumnName = "ServiceStatus")]
        public int? ServiceStatus { get; set; }


        /// <summary>
        /// 文件类型 灵活使用
        /// </summary>
        [SugarColumn(ColumnName = "FileType", Length = 50)]
        public string FileType { get; set; }


        ///// <summary>
        ///// 版本id
        ///// </summary>
        //[SugarColumn(ColumnName = "VersionId", IsNullable = false)]
        //public int VersionId { get; set; }
        /// <summary>
        /// 桶名称
        /// </summary>
        [SugarColumn(ColumnName = "BucketName", Length = 64, IsNullable = false)]
        public string BucketName { get; set; }

        /// <summary>
        /// 文件夹id
        /// </summary>
        [SugarColumn(ColumnName = "DirectoryId", IsNullable = true)]
        public int? DirectoryId { get; set; }

        /// <summary>
        /// 文件变更次数
        /// </summary>
        [SugarColumn(ColumnName = "ChangeNumber", IsNullable = true)]
        public int? ChangeNumber { get; set; }

        /// <summary>
        /// 文件当前名称
        /// </summary>
        [SugarColumn(ColumnName = "FileNewName", Length = 128, IsNullable = true)]
        public string FileNewName { get; set; }
        /// <summary>
        /// 旧文件名
        /// </summary>
        [SugarColumn(ColumnName = "FileOldName", Length = 128, IsNullable = true)]
        public string FileOldName { get; set; }
        /// <summary>
        /// minio对象名
        /// </summary>
        [SugarColumn(ColumnName = "ObjectName", Length = 128, IsNullable = true)]
        public string ObjectName { get; set; }

        /// <summary>
        /// 
        /// </summary>
        public string FileGuid { get; set; }

        /// <summary>
        /// 文件大小（单位：byte
        /// </summary>
        [SugarColumn(ColumnName = "FileSize", Length = 9, IsNullable = true)]
        public long FileSize { get; set; }

        /// <summary>
        /// 文件状态(1：启用，4：已删除)
        /// <para>工单文件状态 1：启用(默认)  2：驳回 （只有订单或制作单非YW-业务才需要审核）   4：删除  ， 5：变更</para> 
        /// <para>订单合同文件状态： 可以使用枚举  EnumStatesType</para>
        /// </summary>
        [SugarColumn(ColumnName = "FileStatus", Length = 4, IsNullable = false)]
        public int FileStatus { get; set; } = 1;


        public DateTime? OperatorTime { get; set; }

        public string? OperatorRemark { get; set; }

        /// <summary>
        /// 第三方引用id
        /// </summary>
        public string? ReferenceId { get; set; }
        /// <summary>
        /// 创建人id
        /// </summary>
        [SugarColumn(ColumnName = "CreateUserId", Length = 50, IsNullable = true)]
        public string CreateUserId { get; set; }
        /// <summary>
        /// 创建人姓名
        /// </summary>
        [SugarColumn(ColumnName = "CreateUserName", Length = 20, IsNullable = true)]
        public string? CreateUserName { get; set; }
        /// <summary>
        /// 创建时间
        /// </summary>
        [SugarColumn(ColumnName = "CreateTime", Length = 8, IsNullable = true)]
        public DateTime CreateTime { get; set; }
        /// <summary>
        /// 更新人id
        /// </summary>
        [SugarColumn(ColumnName = "UpdateUserId", Length = 50, IsNullable = true)]
        public string? UpdateUserId { get; set; }
        /// <summary>
        /// 更新人姓名
        /// </summary>
        [SugarColumn(ColumnName = "UpdateUserName", Length = 20, IsNullable = true)]
        public string? UpdateUserName { get; set; }
        /// <summary>
        /// 更新时间
        /// </summary>
        [SugarColumn(ColumnName = "UpdateTime", Length = 8, IsNullable = true)]
        public DateTime? UpdateTime { get; set; }
    }
}
